package com.lch.thread.juc;

import java.util.concurrent.CyclicBarrier;

/**
 * 同步屏障
 * @author: liuchenhui
 * @create: 2019-05-24 18:04
 **/
public class CyclicBrrierClientDemo {
    public static void main(String[] args) {
        CyclicBarrier cyclicBarrier = new CyclicBarrier(3, new Runnable() {
            @Override
            public void run() {
                System.out.println("开始处理结果");
            }
        });
        for (int i = 1; i < 4; i++) {
            new CyclicBarrierDemo(cyclicBarrier, i).start();
        }
    }
}
